package com.mazsn.factory;
import com.mazsn.interfa.Shape;
import com.mazsn.interfa.impl.Circle;
import com.mazsn.interfa.impl.Rectangle;
import com.mazsn.interfa.impl.Square;

/**
 * 创建模型的工厂
 * @author mazhongshan
 *
 */
public class ShapeFactory {

	    //使用 getShape 方法获取形状类型的对象
	   public Shape getShape(String shapeType){
	      if(shapeType == null){
	         return null;
	      }        
	      if(shapeType.equalsIgnoreCase("CIRCLE")){
	         return new Circle();
	      } else if(shapeType.equalsIgnoreCase("RECTANGLE")){
	         return new Rectangle();
	      } else if(shapeType.equalsIgnoreCase("SQUARE")){
	         return new Square();
	      }
	      return null;
	   }
}
